package Java;

import java.util.Scanner;

public class test18 {
//    定义三个无参数无返回值方法，分别实现计算三角形、正方形、长方形的面积。
        public static void main(String[] args) {
            chanfgangxing();
        }
        public static void chanfgangxing() {
            Scanner scanner = new Scanner(System.in);
            System.out.println("长方形的长：");
            double h = scanner.nextDouble();
            System.out.println("长方形的宽：");
            double a = scanner.nextDouble();
            double S = a * h;
            System.out.println(S);
        }
        public static void zhengfangxing() {
            Scanner scanner = new Scanner(System.in);
            System.out.println("正方形的边长：");
            double h = scanner.nextDouble();
            double S = h * h;
            System.out.println(S);

        }

        public static void sanjiapxing() {
            Scanner scanner = new Scanner(System.in);
            System.out.println("三角形的高：");
            double h = scanner.nextDouble();
            System.out.println("三角形的底：");
            double a = scanner.nextDouble();
            double S = 1 / 2 * a * h;
            System.out.println(S);

        }


}